<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <base href="<%=basePath%>">

    <title>My JSP 'Demo.jsp' starting page</title>

    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    <title>铁路运输登陆界面</title>
</head>

<body style=background-image:url(17.jpg);>
<center>
    <h1><font color="red">12593铁路运输管理员登陆界面</font></h1>
    <hr/>
    <br/>
    <br/>

    <%
        String error = (String)application.getAttribute("err");
        if (error != null) {
    %>
    <h2><%=error%></h2>
    <% } %>

    <form action="admin" method="post" onsubmit="return login()">
        <table>
            <tr>
                <td colspan="2"><h1>管理员登陆</h1></td>
            </tr>
            <tr>
                <td>用户名：</td>
                <td><input type="text" name="id"></td>
            </tr>
            <tr>
                <td>密&nbsp;&nbsp;码：</td>
                <td><input type="password" name="password"></td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type="hidden" name="status" value="login">
                    <input type="submit" value="登陆">
                    <input type="reset" value="重置">
                </td>
            </tr>
        </table>
    </form>
</center>

<script language="javaScript">
    /*	function onlyEng()
     {
     if(!(event.keyCode>=65&&event.keyCode<=90))
     event.returnvalue=false;
     }
     function conf(){
     if(window.confirm("确认登陆用户名为？")){
     return true;
     }
     return false;
     }*/
    function login() {
        if (document.person.id.value == "") {
            alert("用户名不能为空");
            document.person.id.focus();
            return false;
        }
        if (document.person.password.value == "") {
            alert("密码不能为空");
            document.person.password.focus();
            return false;
        }
        if (document.person.id.value.length > 10) {
            alert("用户名长度不能大于10");
            document.person.id.focus();
            return false;
        }
        if (document.person.password.value.length > 15) {
            alert("请输入长度小于15的密码");
            document.person.password.focus();
            return false;
        }
        return true;
    }
</script>
</body>
</html>
